package com.wc.codeforces.贪心.Yet_Another_Coin_Problem;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/6/24 15:39
 * @description https://codeforces.com/problemset/problem/1934/B
 */
public class Main {
    /**
     * 思路：贪心
     * 1的个数不会超过2, 超过了会用3的
     * 3的个数不会超过1, 超过了会用6的
     * 6的个数不会超过4, 超过了会用15的
     * 10的个数不会超过2, 超过了会用15的
     * 综上得, 遍历即可
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int INF = (int) 1e9;
    static int n;

    public static void main(String[] args) {
        int T = sc.nextInt();
        while (T-- > 0) {
            n = sc.nextInt();
            int res = INF;
            // a -> 1, b -> 3, c -> 6, d -> 10
            for (int a = 0; a <= 2; a++) {
                for (int b = 0; b <= 1; b++) {
                    for (int c = 0; c <= 4; c++) {
                        for (int d = 0; d <= 2; d++) {
                            int last = a + b * 3 + c * 6 + d * 10;
                            if (last <= n && (n - last) % 15 == 0) {
                                res = Math.min(res, a + b + c + d + (n - last) / 15);
                            }
                        }
                    }
                }
            }
            out.println(res);
        }
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
